<template>
  <div class="attendance-record-page">
    <h2 class="page-title">考勤记录</h2>
    <el-button type="text" class="return-btn" @click="handleReturn">返回</el-button>

    <!-- 筛选区域 -->
    <div class="filter-area">
      <el-select v-model="selectedName" placeholder="请选择" style="width: 200px; margin-right: 20px;">
        <el-option label="请选择" value="" />
        <el-option label="李悦" value="李悦" />
        <el-option label="张梅" value="张梅" />
      </el-select>

      <el-radio-group v-model="timeRange" style="margin-right: 20px;">
        <el-radio label="today">今天</el-radio>
        <el-radio label="week" v-model="timeRange">本周</el-radio>
        <el-radio label="month">本月</el-radio>
      </el-radio-group>

      <el-input v-model="keyword" placeholder="请输入关键词" style="width: 180px; margin-right: 10px;" />
      <el-button type="primary" >搜索</el-button>
    </div>

    <!-- 考勤表格 -->
    <el-table :data="attendanceList" border style="width: 100%; margin-top: 20px;">
      <el-table-column type="selection" width="50" />
      <el-table-column prop="name" label="姓名" sortable />
      <el-table-column prop="date" label="日期" sortable />
      <el-table-column prop="clockType" label="上下班打卡" sortable />
      <el-table-column prop="store" label="打卡门店" sortable />
      <el-table-column label="打卡状态">
        <template #default>
          <el-icon class="success-icon"><Check /></el-icon>
        </template>
      </el-table-column>
      <el-table-column prop="isLate" label="是否迟到/早退" sortable />
      <el-table-column prop="remark" label="备注" sortable />
    </el-table>

    <!-- 分页区域 -->
    <div class="pagination-area">
      <span class="total-info">共 4 条 共 4 页</span>
      <el-pagination
        @current-change="handleCurrentChange"
        @size-change="handleSizeChange"
        :current-page="currentPage"
        :page-sizes="[10, 20, 30]"
        :page-size="pageSize"
        layout="prev, pager, next"
        :total="4"
      />
      <el-select v-model="pageSize" @change="handleSizeChange" placeholder="条数/页" style="width: 100px; margin-left: 10px;">
        <el-option label="10条/页" value="10" />
        <el-option label="20条/页" value="20" />
        <el-option label="30条/页" value="30" />
      </el-select>
      <span>跳至</span>
      <el-input v-model="jumpPage" type="number" style="width: 50px; margin: 0 5px;" />页
      <el-button type="primary"    >确定</el-button>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { Check } from '@element-plus/icons-vue';

// 筛选条件
const selectedName = ref('');
const timeRange = ref('week');
const keyword = ref('');

// 考勤数据
const attendanceList = ref([
  {
    name: '李悦',
    date: '2014.11.11 09:39:51',
    clockType: '上班签到',
    store: '南京21世纪股份有限公司',
    isLate: '未迟到',
    remark: ''
  },
  {
    name: '李悦',
    date: '2014.11.11 18:39:51',
    clockType: '下班签退',
    store: '南京21世纪股份有限公司',
    isLate: '未早退',
    remark: ''
  },
  {
    name: '张梅',
    date: '2014.11.11 09:39:51',
    clockType: '上班签到',
    store: '南京21世纪股份有限公司',
    isLate: '未迟到',
    remark: ''
  },
  {
    name: '张梅',
    date: '2014.11.11 14:39:51',
    clockType: '下班签退',
    store: '南京21世纪股份有限公司',
    isLate: '早退',
    remark: '外出办公'
  }
]);

// 分页参数
const currentPage = ref(1);
const pageSize = ref(10);
const jumpPage = ref('');

// 分页方法
const handleCurrentChange = (val) => {
  currentPage.value = val;
  console.log('当前页：', val);
};

const handleSizeChange = (val) => {
  pageSize.value = val;
  console.log('每页条数：', val);
};

// 返回操作
const handleReturn = () => {
  console.log('返回');
};
</script>

<style scoped>
.attendance-record-page {
  padding: 20px;
  background-color: #fff;
  min-height: 100vh;
  position: relative;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0 0 20px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.return-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  color: #666;
}

.filter-area {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.success-icon {
  color: #00b4b4;
  font-size: 18px;
}

.pagination-area {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.total-info {
  color: #666;
}

.el-pagination {
  margin: 0;
}

.el-input {
  width: auto;
}
</style>